package com.common.preimgloader;

import android.app.Activity;
import android.graphics.Rect;

import com.previewlibrary.GPreviewBuilder;

import java.util.ArrayList;
import java.util.List;

/**
 * 请注意：
 * 在主项目里面manifest.xml声明LookActivity
 */
public class StartPreViewActivityUtil {
    static ArrayList<ImageBean> mThumbViewInfoList = new ArrayList<>(); // 这个最好定义成成员变量
    /**
     * 图片预览启动
     * @param list
     * @param context
     * @param position
     */
    public static void startPre(List<String> list, Activity context,int position){
        ImageBean item;
        mThumbViewInfoList.clear();
        for (int i = 0;i < list.size(); i++) {
            item=new ImageBean(list.get(i),new Rect());
            mThumbViewInfoList.add(item);
        }
        GPreviewBuilder.from(context)
                .to(ImageLookActivity.class)
                .setData(mThumbViewInfoList)
                .setCurrentIndex(position)
                .setSingleFling(true)
                .setDrag(false)
                .setType(GPreviewBuilder.IndicatorType.Number)
//  .setType(GPreviewBuilder.IndicatorType.Dot)
                .start();//启动
    }
}
